package com.heima.admin.listen;

import com.heima.admin.service.WemediaNewsAutoScanService;
import com.heima.common.constans.message.NewsAutoScanConstants;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.kafka.annotation.KafkaListener;

@ComponentScan
@Slf4j
public class WemediaNewsAutoListener {
    @Autowired
    WemediaNewsAutoScanService wemediaNewsAutoScanService;
    @KafkaListener(topics = NewsAutoScanConstants.WM_NEWS_AUTO_SCAN_TOPIC)
    public void handlerNewsAutoScanMsg(String newsId){
        log.info("自动审核方法被调用==》newsid:{}",newsId);
        if(StringUtils.isNotBlank(newsId)){
            wemediaNewsAutoScanService.autoScanByMediaNewsId(Integer.valueOf(newsId));
            log.info("自动审核方法调用结束==》newsId",newsId);
        }
    }
}
